using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace wires_as_objects
{
    class Split_config_into_parameters
    {
        public void Process(string configuration)
        {
            this.Result(configuration.Split(';'));
        }

        public event Action<IEnumerable<string>> Result;
    }

    class Split_parameters_into_key_and_value
    {
        public void Process(IEnumerable<string> parameters)
        {
            var kvPairs = parameters.Select(p => p.Split('=')).Select(kv => new KeyValuePair<string, string>(kv[0], kv[1])).ToList();
            this.Result(kvPairs);
        }

        public event Action<IEnumerable<KeyValuePair<string, string>>> Result;
    }

    class Assemble_dictionary
    {
        public void Process(IEnumerable<KeyValuePair<string, string>> kvPairs)
        {
            var dict = new Dictionary<string, string>();
            foreach (var kvp in kvPairs)
                dict[kvp.Key] = kvp.Value;
            this.Result(dict);
        }

        public event Action<Dictionary<string, string>> Result;
    }
}